package com.shunhe.shyqfk.support.view;

import android.content.Context;
import android.util.AttributeSet;

import com.ailiwean.core.Result;
import com.ailiwean.core.view.style1.NBZxingView;

public class CusZxingView extends NBZxingView {

    public CusZxingView(Context context, AttributeSet attributeSet, int def) {
        super(context, attributeSet, def);
    }

    public CusZxingView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
    }

    public CusZxingView(Context context) {
        super(context);
    }

    private Result content;

    public Result getContent() {
        return content;
    }

    @Override
    public void resultBack(Result content) {
        super.resultBack(content);
        this.content = content;
        if (null != onGetScanResultListener) {
            onGetScanResultListener.onGetScanResult(content);
        }
    }

    /**
     * 恢复扫码
     */
    public void cameraResume() {
        onCameraResume();
    }

    /**
     * 暂停扫码
     */
    public void cameraPause() {
        onCameraPause();
    }

    public OnGetScanResultListener getOnGetScanResultListener() {
        return onGetScanResultListener;
    }

    public void setOnGetScanResultListener(OnGetScanResultListener onGetScanResultListener) {
        this.onGetScanResultListener = onGetScanResultListener;
    }

    public OnGetScanResultListener onGetScanResultListener;

    public interface OnGetScanResultListener {
        void onGetScanResult(Result content);
    }
}
